107 台大計系

Computer Architecture

1

a. please explain what architecture support is needed for this.

Operating System 9th pg.376 - We first need to make sure…
Computer Architecture 5th pg.44 - what is architecture?
Computer Orgnization 5th pg.432 - why page table?

b. please explain out-of-order execution(OOOE) is indispensable performance feature on modern processors.

lw	$t0, 20($s2)
addu	$t1, $t0, $t2  #load-use ,用forwarding仍需花費one cycle stall
sub	$s4, $s4, $t3

在 in-order execution 情況下,即使 sub 與 lw、addu 沒有資料相依, sub 仍必須等待,如果 lw 發生 cahce miss 的話,要存取 memory 拿資料,可能會花費相當多 clock cycle,OOOE 可以避免這種情況。

張凡課本下冊,動態多重分發處理器

c. 解釋 speculatively 的優缺點

張凡課本下冊,speculation

d. 造成例外的原因,現代處理器如何處理 out-of-order 造成的例外及正確性

https://www.cs.virginia.edu/~cr4bd/3330/S2017/notes/20170316-part2-slides-1up.pdf

e. 解釋 cache 的重要性,及為何 cache data 會有不同

http://www.cc.ntu.edu.tw/chinese/epaper/0045/201806204508.html


2

(f)

每台電腦需處理 1015NBytes,每個 disk 裝 1015NDBytes,transfer rate 250MB/sec

(g)

(h)

(i)

3 Which processor below isn’t affected by Meltdown?

( C ) - intel Itanium

張凡課本下冊,VLIW

4

5 Which statement below is FALSE…?

(b) - 是8-bit 不是32-bit

https://cloud.google.com/blog/products/gcp/an-in-depth-look-at-googles-first-tensor-processing-unit-tpu

6 Which … does’t exploit parallelism?

(b)

a. ILP

b. none

c. ILP (superscalar)

d. TLP、DLP

張凡課本,定義ILP
Computer Orgnization 5th pg.525
Computer Architecture 5th pg.38

7 Branch prediction is more important…

(T)

張凡課本,control hazard

8 Two instructions … may not cause data hazard…

(T)

張凡課本,data hazard

9 If VIPT is used, one RAM data…

(F)
張凡課本,virtual index virtual tag(VIVT)


Operating System

10

a

  1. CPU產生VA
  2. 餵給TLB
  3. hit的話,將PA餵給Cache
    miss的話 ,將原來的VA餵給page table找到PA
    ┌───┐ ┌───┐hit┌────┐
    │CPU │→│TLB │-→│Cache│
    └───┘ └───┘ – └────┘
    TLB miss↓
    ┌───────┐
    │page table│
    └───────┘

張凡課本,TLB

b 1.F12C 2.2A9D 3.Page fault

c inverted page table && multilevel page table

d Please discribe possible method… and discuss the performance

Operating System 9th pg.374
https://stackoverflow.com/questions/21887797/what-is-the-overhead-of-a-context-switch

11 In Linux scheduler, what performance is improved using red-black-tree …

CFQ, deadline(恐龍書上只提到 CFQ )
理論上紅黑樹為一棵 balanced tree,在上面 search、delete 只要花費 O(lg n) 的時間

補充:

https://lwn.net/Articles/184495/
https://www.infradead.org/~mchehab/kernel_docs/unsorted/rbtree.html

12

13

實際舉硬碟排班例子 (1)FCFS會比SSTF優的 (2)FCFS比SSTF差

14 Binary Semaphore to Counting Semaphor

Semaphore S1,S2
int c
wait(S)
{
    wait(s1);
    c = c-1;
    if (c < 0)
    {
        signal(s1);
        wait(s2);
    }
    else signal(s1);
}
signal(s)
{
    wait(s1);
    c = c+1;
    if(c <= 0)
    {
        signal(s2);
    }
    signal(s1);
}